<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, 
initial-scale=1.0'>
<meta http-equiv='X-UA-Compatible' content='ie=edge'>
<title>Document</title>
</head>
<body>
	<script src="./node_modules/redux/dist/redux.js"></script>
	<script>
		// console.log( Redux );

		// 创建 reducer
		let reducer = (state,action)=>{
			console.log( "reducer" );
			console.log( action );
			return state;
		};
		// oldstate + action => newState

		// UI = ( state,props )

		// 创建 store
		let store = Redux.createStore( reducer,{a:1} );
		// console.log( store );

		// 获取数据
		// console.log( store.getState() );

		// console.log( store )
		// 注册监听器
		store.subscribe( ()=>{
			console.log( "subscribe" );
		} )
		var unsubscribe =  store.subscribe( ()=>{
			console.log( "subscribe111111" );
		} )
		unsubscribe();

		// console.log( unsubscribe );
		// 设置数据
		store.dispatch({
			type: "A"
		});
	</script>
</body>
</html>